package com.linsir.lin.service;

import com.linsir.core.BaseResponse;
import com.linsir.lin.dto.GridDTO;
import com.linsir.lin.dto.PositionDTO;
import com.linsir.lin.pojo.Position;

import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.text.ParseException;
import java.util.List;
import java.util.Map;

/**
 * @ProjectName:linsir-lin
 * @Package:com.linsir.lin.service
 * @Title: OrganizationService
 * @Description: 职务接口
 * @Create:2021/7/10 17:24 by @author:huangqg
 * @UpdateRemark: 初始创建
 * @Version: 1.0.0
 */
public interface PositionService {
    /**
     * 职务列表
     * @param page
     * @param limit
     * @param searchParams
     * @return
     * @throws IOException
     * @throws InvocationTargetException
     * @throws IllegalAccessException
     */
    GridDTO<PositionDTO> grid(String page,
                              String limit,
                              String searchParams) throws IOException, InvocationTargetException, IllegalAccessException;

    /**
     * 转化
     * @param position
     * @return
     * @throws InvocationTargetException
     * @throws IllegalAccessException
     */
    PositionDTO toDTO(Position position)throws InvocationTargetException, IllegalAccessException;

    /**
     * 转化集合
     * @param positions
     * @return
     * @throws InvocationTargetException
     * @throws IllegalAccessException
     */
    List<PositionDTO> toDtoList(List<Position> positions) throws InvocationTargetException, IllegalAccessException;

    /**
     * 新增职务
     * @param map
     * @param organId
     * @return
     * @throws ParseException
     */
    BaseResponse<Boolean> addOrUpdate(Map<String, Object> map,Integer organId)throws ParseException;

    /**
     * 批量删除
     * @param ids
     * @return
     */
    BaseResponse<Boolean> batchDel(String ids);

    /**
     * 根据ID获取对象
     * @param id
     * @return
     */
    Position getById(Integer id);

    /**
     * 根据ID获取DTO对象
     * @param id
     * @return
     * @throws InvocationTargetException
     * @throws IllegalAccessException
     */
    PositionDTO getDTObyId(Integer id) throws InvocationTargetException, IllegalAccessException;

    /**
     * 编辑职务
     * @param map
     * @param positionId
     * @return
     */
    BaseResponse<Boolean> edit(Map<String, Object> map, Integer positionId) throws ParseException;

    /**
     * 获取列表集合，模糊查询
     * @param page
     * @param limit
     * @param organId
     * @param searchParams
     * @return
     * @throws IOException
     * @throws InvocationTargetException
     * @throws IllegalAccessException
     */
    GridDTO<PositionDTO> gridList(String page,
                               String limit,
                               Integer organId,
                               String searchParams) throws IOException, InvocationTargetException, IllegalAccessException;
}
